<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>批量添加优惠券</title>
<link href="../img/base.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="/img/jquery.js"></script>
<script language="javascript" src="/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
	function checkCoupon(){
		var tof = true;
		
		var total_value = $('#total_value').val();
		var mobile = $('#mobile').val();
		var number = $('#number').val();
		var len = $('#len').val();
		var pwd = $('#pwd').val();
		var print_value = $('#print_value').val();
		var batch_id = $('#batch_id').val();
		
		if(batch_id==0)
		{
			tof = false;
			alert('请选择批次！');
		}
		var str = /^\d+$/;
		if(total_value == '' && total_value == null){
			tof = false;
			alert('总数不能为空');
		}else if(!str.test(total_value) || total_value>5){
			tof = false;
			alert('张数最多不超过5张');	
		}
		
		if( !str.test(print_value) || (print_value < 25))
		{
			tof = false;
			alert('打印金额不少于25元');
		}

		if(len != '' && len != null){
			if(!str.test(len)){
				tof = false;
				alert('码长度必须是数字');
			}
		}
		
		if(pwd != '' && pwd != null){
			if(!str.test(pwd)){
				tof = false;
				alert('密码长度必须是数字');
			}
		}
		
		if(mobile.length < 1 && number == '' && number != null){
			tof = false;
			alert('手机号码和生成数量必填一项');	
		}else if(number != '' && number != null){
			if(!str.test(number)){
				tof = false;
				alert('生成数量必须是数字');
			}
		}
		
		return tof;
	}
</script>
</head>
<body leftmargin='15' topmargin='10' bgcolor="#FFFFFF">
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0" id="head1" style="border-bottom:1px solid #CCCCCC">
	<tr>
    	<td align='center' valign='top' colspan="2">
            <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D1DDAA">
                <tr>
                    <td height="26" background="../img/newlinebg3.gif">
                        <table width="98%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td align="right">
                                    <input type='button' class="coolbg np" onClick="location='coupon.php';" value='返回' />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
    	<td>
        	<table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr bgcolor="#FFFFFF">
                    <td height="4"></td>
                </tr>
            </table>
        </td>
    </tr>
  	<tr>
    	<td colspan="2">
      		<table width="800" border="0" cellpadding="0" cellspacing="0">
        		<tr>
          			<td width="84" height="24" align="center" background="../img/itemnote1.gif">&nbsp;添加优惠券&nbsp;</td>
          			<td width="84"></td>
          			<td>&nbsp;</td>
        		</tr>
      		</table>
    	</td>
	</tr>
</table>
<form name="form1" action="" enctype="multipart/form-data" method="post" onsubmit="return checkCoupon()">
<table width="98%"  border="0" align="center" cellpadding="2" cellspacing="2" id="needset">

	<tr>
    	<td height="24" colspan="4" class="bline">
      		<table width="800" border="0" cellspacing="0" cellpadding="0">
        		<tr>
          			<td width="120">&nbsp;真实姓名：</td>
          			<td width="680">
                   <{$real_name}></td>
                   
        		</tr>
      		</table>      
    	</td>
  	</tr>

  	<tr>
    	<td height="24" colspan="4" class="bline">
      		<table width="800" border="0" cellspacing="0" cellpadding="0">
        		<tr>
          			<td width="90">&nbsp;类型：</td>
          			<td width="35%">
                    	<select name="type_id">
                        	<{foreach from=$coupon_type_list item=type}>
                            <{if $type.type_id == 2}><option value="<{$type.type_id}>"><{$type.type_name}></option><{/if}>
                            <{/foreach}>
                        </select>
                    </td>
                    <td width="90">&nbsp;批次：</td>
          			<td width="35%">
                    	<select id="batch_id" name="batch_id">
                        	<option value="0">请选择</option>
                        	<{foreach from=$coupon_batch_list item=batch}>
                            <option value="<{$batch.batch_id}>"><{$batch.batch_name}></option>
                            <{/foreach}>
                        </select>
                    </td>
        		</tr>
      		</table>      
    	</td>
  	</tr>
    <tr>
    	<td height="24" colspan="4" class="bline">
      		<table width="800" border="0" cellspacing="0" cellpadding="0">
                <tr>
          			<td width="90">&nbsp;张数：</td>
          			<td width="35%"><input type="text" id="total_value" name="total_value" value="" /><span style="color:#F00"> *必填,最多不超过5张</span></td>
                    <td width="90">&nbsp;销售金额：</td>
          			<td width="35%"><input type="text" id="sale_value" name="sale_value" value="0" /><span style="color:#F00"> 0表示赠送，报表相关</span></td>
        		</tr>
      		</table>      
    	</td>
  	</tr>
  	<tr>
    	<td height="24" colspan="4" class="bline">
      		<table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
          			<td width="119">&nbsp;兑换券面额：</td>
          			<td width="283"><input name="face_value" type="text" id="face_value" value="0" readonly="readonly" /><span style="color:#F00"> 0表示不限制</span></td>
                    <td width="120">&nbsp;打印价格：</td>
          			<td><input type="text" id="print_value" name="print_value" value="" />
          			<span style="color:#F00"> *即结算价格,不低于25</span></td>
        		</tr> 
      		</table>      
    	</td>
  	</tr>
  	<tr>
    	<td height="24" colspan="4" class="bline">
      		<table width="800" border="0" cellspacing="0" cellpadding="0">
                <tr>
          			<td width="90">&nbsp;开始时间：</td>
          			<td width="35%"><input type="text" name="start_date" value="" onClick="WdatePicker()" /></td>
                    <td width="90">&nbsp;结束时间：</td>
          			<td width="35%"><input type="text" name="end_date" value="" onClick="WdatePicker()" /><span style="color:#F00"> * 含该日期</span></td>
        		</tr> 
      		</table>      
    	</td>
  	</tr>
    <tr>
    	<td height="24" colspan="4" class="bline">
      		<table width="800" border="0" cellspacing="0" cellpadding="0">
                <tr>
          			<td width="90">&nbsp;手机号码：</td>
          			<td width="85%" colspan="3">
                    	<textarea id="mobile" name="mobile" rows="3" cols="100"></textarea><br /><span style="color:#F00">* 多个号码请用“,”号隔开</span>
                    </td>
        		</tr>
      		</table>      
    	</td>
  	</tr>
    <tr>
    	<td height="24" colspan="4" class="bline">
      		<table width="800" border="0" cellspacing="0" cellpadding="0">
                <tr>
                	<td width="90">&nbsp;码长度：</td>
          			<td width="35%"><input type="text" id="len" name="len" value="8"/></td>
          			<td width="90">&nbsp;密码长度：</td>
          			<td width="35%"><input type="text" id="pwd" name="pwd" value="0" /></td>
        		</tr> 
      		</table>      
    	</td>
  	</tr>
    <tr>
    	<td height="24" colspan="4" class="bline">
      		<table width="800" border="0" cellspacing="0" cellpadding="0">
                <tr>
          			<td width="90">&nbsp;生成数量：</td>
          			<td width="85%" colspan="3"><input type="text" id="number" name="number" value="" /><span style="color:#F00"> * 如果填写手机号码此项可不填</span></td>
        		</tr> 
      		</table>      
    	</td>
  	</tr>
</table>

<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
    	<td height="56">
			<table width="98%" border="0" cellspacing="1" cellpadding="1">
        		<tr>
          			<td align="center">
          				<table width="214" border="0" cellspacing="0" cellpadding="0" >
              				<tr>
				                <td width="115">
                                	<input type="hidden" name="op" value="add" />
				                    <input name="imageField" type="image" src="../img/button_ok.gif" width="60" height="22" class="np" border="0"  style="cursor:pointer; ">
				                </td>
				                <td width="99">
				                	<img src="../img/button_reset.gif" width="60" height="22" border="0" onClick="location.reload();" style="cursor:pointer; ">
				                </td>
			              	</tr>
						</table>
					</td>
    			</tr>
			</table>
		</td>
	</tr>
</table>
</form>
</body>

</html>